#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int main() {
    int num = 2019;
    int count = 0;
    int i = 0;
    for (i = 1; i <= num; i++)
    {
        int n = i;
        while (n)
        {
            if (n % 10 == 9)
            {
                count++;
                break;
            }
            else
            {
                n /= 10;
            }
        }
    }
    printf("%d\n", count);
    return 0;
}